package com.jchen.auth.mq;

import com.jchen.common.constant.QueueConstant;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Description 消息接收监听类
 * @Author jchen
 * @Date 2023/12/13 10:33
 */

@Component
public class DirectReceiver {

    @RabbitListener(queuesToDeclare = @Queue(QueueConstant.JCHEN_QUEUE_NAME))//监听的队列名称 TestDirectQueue
    @RabbitHandler
    public void process(Map testMessage) {
        System.out.println("测试mq:"+testMessage.toString());
    }


    @RabbitListener(queuesToDeclare = @Queue(QueueConstant.SYS_QUEUE_NAME))  //queuesToDeclare没有队列会自己创建
    //@RabbitListener(queues = QueueConstant.SYS_QUEUE_NAME)
    @RabbitHandler
    public void process2(Map testMessage) {
        System.out.println("系统mq:"+testMessage.toString());
    }
}
